Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AC-4 Level-4 ISO base media file format support #1265

Closed

Conversation

ybai001
Copy link
Contributor

@ybai001 ybai001 commented Apr 11, 2024

This pull request is same as #875. Since 875 is broken due to too many commit numbers, I re-created this new one.

========================

AC-4 Level-4 (Object Based Audio) is a Dolby official audio stream type for Atmos Music. This code update enables Android Media3 support local MP4 and MPEG-DASH AC-4 Level-4 playback.

// Using first presentation (default presentation) channel count
int presentationIndex = 0;
Ac4Presentation ac4Presentation =
Objects.requireNonNull(ac4Presentations.get(presentationIndex));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ybai001,

Why are we looping over all presentationIndex above and storing it in a Map when all we require is the ac4Presentation for the index 0?

Is it to verify if the file doesn't have bad data? Even in that case storing it in a Map seems an overkill, when we don't intend to use the map for anything else but index 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rohitjoins,
This AC4 parser implementation is similar as the one in Android Framework: https://cs.android.com/android/platform/superproject/main/+/main:frameworks/av/media/module/extractors/mp4/AC4Parser.cpp;drc=2e87c835abea90b0cf61b42dc9aa8a882f2ef5aa;l=292. It parses all the information for all presentations because there is API https://developer.android.com/reference/android/media/MediaExtractor#getAudioPresentations(int) to fetch the presentations info for appointed audio track.

Since AndroidX Media extractor doesn't support AudioPresentation, I know this loop is redundant now.

But I know Android framework MPEGExtractor was deprecated and it will be replaced by AndroidX Media extractor. Although AndroidX Media doesn't support AudioPresentation now but I believe it will support it sooner or later. That's why I use a Map to store all audio presentation info and keep this logic in my implementation.

If one audio track includes multiple audio presentations, and if application doesn't set which presentation should be played, the Dolby AC-4 decoder will decode the default presentation (the first presentation).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ybai001,

I would suggest to remove any logic which will be used in the future as it can be added when required. For now we should only parse and use the first presentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rohitjoins , OK, I'll update the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rohitjoins, I have updated the code as your suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sqshet-dlb,

I’m currently making some updates to the PR, such as adding more documentation and refactoring some parts into new methods before sending it for internal review. I’ll keep you updated on the progress and aim to merge it soon.

Hi, @rohitjoins, as you mentioned on July 2nd,
I'll take a look and send this PR for internal review.
It's nearly 3 months. Could you help to explain why this pull request has not been sent for internal review? Could you give me a deadline? This is very important for us since it blocks several other contributions as @sqshet-dlb said.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @rohitjoins
Could you help to provide us any update about this contribution?
Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rohitjoins , there is a merge conflict with IAMF code. Do I need to resolve this conflict? Because you said you would send this for internal code review, I'm not sure whether I should modify code again. Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ybai001,

No need to update this PR as I already do it for the internal version. If no blockers come up in review, this should be merged this week.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rohitjoins, thanks for the quick feedback. :)

copybara-service bot pushed a commit that referenced this pull request Nov 13, 2024
@rohitjoins
Copy link
Contributor

Hi @ybai001,

The PR has been merged as 74611bb.

I refactored the code to remove elements from AudioPresentations that aren’t currently needed, as we’re not returning it yet. Please take a look at the merged commit and let me know if you spot any issues.

@rohitjoins rohitjoins closed this Nov 13, 2024
@ybai001
Copy link
Contributor Author

ybai001 commented Nov 14, 2024

Hi @ybai001,

The PR has been merged as 74611bb.

I refactored the code to remove elements from AudioPresentations that aren’t currently needed, as we’re not returning it yet. Please take a look at the merged commit and let me know if you spot any issues.

Hi, @rohitjoins

I truly appreciate your effort on this pull request. It's almost one year! :) I understood this was a big change in extractor and it was related to Dolby specific format that you were not familiar with. I have verified it on my test device based on the lastest main branch code. It can work. So thanks again!

icbaker pushed a commit that referenced this pull request Nov 15, 2024
PiperOrigin-RevId: 696157037
(cherry picked from commit 74611bb)
icbaker pushed a commit that referenced this pull request Nov 16, 2024
PiperOrigin-RevId: 696157037
(cherry picked from commit 74611bb)
icbaker pushed a commit that referenced this pull request Nov 19, 2024
PiperOrigin-RevId: 696157037
(cherry picked from commit 74611bb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants